/*
 * Systray.java
 *
 * Created on 12 de Fevereiro de 2009, 22:14
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package gui.systray;

import gui.AbstractSystray;

/**
 *
 * @author vinicius
 */
public class Systray extends AbstractSystray{
    
    private static AbstractSystray abstractSystray;
    
    private Systray() {
        String javaVersion = System.getProperty("java.version");
               
        float version = 1.4f;
        try{
            int sepoint = javaVersion.indexOf(".")+1;
            sepoint = javaVersion.indexOf(".", sepoint);
            javaVersion = javaVersion.substring(0,sepoint);
            version = Float.parseFloat(javaVersion);            
        }catch(Exception ex){
            ex.printStackTrace();
        }
               
        if(version <= 1.5f)
            abstractSystray = Systray5.getInstance();
        else
            abstractSystray = Systray6.getInstance();
        
    }
    
    public synchronized static AbstractSystray getInstance()
    {
        
        if (abstractSystray==null)
            new Systray();
        return abstractSystray;
    }

    public void activatetTrayIcon() {
        abstractSystray.activatetTrayIcon();
    }

    public void deactivatetTrayIcon() {
    }

    public void minimizar() {
        abstractSystray.minimizar();
    }

    public void displayInfoMessage(String message) {
        abstractSystray.displayInfoMessage(message);
    }

    public void displayErrorMessage(String message) {
        abstractSystray.displayErrorMessage(message);
    }

    public void displayWarningMessage(String message) {
        abstractSystray.displayWarningMessage(message);
    }

    public void displayMessage(String message) {
        abstractSystray.displayMessage(message);
    }

    public boolean isTrayIconON() {
        return abstractSystray.isTrayIconON();
    }
    
}
